//
//  BYProductDetailsSubInfoCell.m
//  OCDemo
//
//  Created by zhumuzhi on 2022/2/12.
//

#import "BYProductDetailsSubInfoCell.h"
#import "BYProductDetailsModel.h"

@interface BYProductDetailsSubInfoCell ()

@property (nonatomic, strong) UILabel *title;

@end


@implementation BYProductDetailsSubInfoCell

#pragma mark - CellHeight
+ (CGFloat)cellHeight {
    return 20.0f;
}

#pragma mark - SetData

- (void)setModel:(BYProductDetailsModel *)model {
    _model = model;
    
    if(2 == self.indexPath.row) {
        self.title.text = [NSString stringWithFormat:@"品牌：%@", model.brand];
    }else if(3 == self.indexPath.row) {
        self.title.text = [NSString stringWithFormat:@"产地：%@", model.place];
    }else if(4 == self.indexPath.row) {
        self.title.text = [NSString stringWithFormat:@"型号：%@", model.model];
    }else if(5 == self.indexPath.row) {
        self.title.text = [NSString stringWithFormat:@"玩具类型：%@", model.category];
    }else if(6 == self.indexPath.row) {
        self.title.text = [NSString stringWithFormat:@"适用年龄：%@", model.age];
    }
}

#pragma mark - Init
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self.contentView addSubview:self.title];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [self.title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(kAutoWithSize(10));
        make.right.equalTo(self.contentView).offset(-kAutoWithSize(10));
    }];
    
    [super layoutSubviews];
}


#pragma mark - LazyGet

- (UILabel *)title {
    if (!_title) {
        _title = [[UILabel alloc] init];
        _title.font = MZFont(12);
    }
    return _title;
}

@end
